import * as PathUtils from "../utils/pathUtils";
import type { FieldTree } from "@model/fieldTree";
import { defineStore } from "pinia";

const UseFieldTree = defineStore("fieldTree", {
  state() {
    const fieldTree: FieldTree = PathUtils.fieldTreeInit;
    return {
      fieldTree: fieldTree,
    };
  },
  actions: {
    setFieldTree: function (fieldTree: FieldTree) {
      // console.log("surfaceSetting", surfaceSetting);
      // console.log('surfaceSetting',...surfaceSetting)
      this.getFieldTree().setInfo(fieldTree);
      // this.surfaceSetting.setInfo(...surfaceSetting);
      // this.setting = setting;
    },
    getFieldTree: function (): FieldTree {
      return this.fieldTree;
    },
  },
  getters: {},
});
export default UseFieldTree;
